<?php
//require_once('../employe/employe_display.php');
require_once('../../include/dis.php');
require_once('../../include/global_display.php');
require_once('chef_de_service_display.php');
require_once('../employe_rh/employeRH_display.php');

error_reporting(E_ALL ^ E_NOTICE);

$display['head'] = display_head('interface chef_de_service');
$display['header']=display_header('interface chef_de_service');
$display['end'] = display_end();
$display['menu'] = dis_menu_chef_de_service();
$display['leftmenu']= dis_left_menu();

if(isset($_GET['action'])){
	$action=$_GET['action'];
}
if (isset($action) && $action=="consult"){
	$display['body']=dis_employe($_SESSION['id']);
}
if (isset($action) && $action=="conges"){
	$display['body']=dis_employe_conges($_SESSION['id'],$_SESSION['stat']);
	$display['res']=dis_conges($_SESSION['id']);
}

if (isset($action) && $action=="search"){
	//$display['body']=dis_employe_conges($_SESSION['id']);
	insert_demande_conges($_SESSION['id']);
	//$display['res']=dis_conges($_SESSION['id']);
	//echo 'lllllllllllllllllllllllllllllllllllllllllllllllllllllll';
	header('Location: chef_de_service_index.php?action=conges');

}
if (isset($action) && $action=="consult_service"){
	$id = $_SESSION['id'];
	$service = mysql_fetch_array(mysql_query("SELECT idservice FROM employe WHERE idemp=$id"));
	$service = $service['idservice'];
	$display['body']=dis_chef_de_service_consult_service($service);	
	$display['res'] = resultat_employeRH();
}
if (isset($action) && $action=="conges_valid"){
	$display['body']=dis_chef_de_service_conges_valid($_SESSION['id']);
}
if (isset($action) && $action=="ouverture"){
	$display['body']=dis_chef_de_service_ouverture($_SESSION['id']);
}

if (isset($action) && $action=="valid"){
	$display['body']= valid_conges($_SESSION['id'],$_SESSION['stat']);
}

if (isset($action) && $action=="valid_conges"){
	$tab=true_false($_GET);
	run_query_valid_conges($tab,$_SESSION['stat']);
	$display['body']= valid_conges($_SESSION['id'],$_SESSION['stat']);
}

if (isset($action) && $action=="afficher_conges"){
	$display['body']= afficher_conges($_SESSION['id'],$_SESSION['stat']);
	$display['body1']= recherche_conges($_SESSION['stat']);
}

echo $display['head'];
echo $display['header'];
echo $display['leftmenu'];
echo $display['menu'];
echo $display['body1'];
echo $display['body'];
echo $display['res'];
echo $display['end'];



?>